package com.itheima.health.dao;

import com.itheima.health.pojo.OrderSetting;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface OrderSettingDao {

    List<OrderSetting> getOrderSettingByMonth(LocalDate begin, LocalDate end);

    @Select("select * from t_ordersetting where order_date=#{orderDate}")
    OrderSetting getOrderSettingByMonthAndDay(Date orderDate);

    @Insert("insert into t_ordersetting(order_date, number,reservations)  " +
            "values (#{orderDate},#{number},#{reservations})")
    void insert(OrderSetting orderSetting);

    void edit(OrderSetting orderSetting);

    @Select("select count(*) from t_ordersetting where order_date =#{orderDate}")
    Integer findCountByDate(Date orderDate);


}
